package com.darren.center.design.patterns.command;

import com.darren.center.design.patterns.dto.Context;

/**
 * <h3>design-patterns</h3>
 * <p></p>
 *
 * @author : Darren
 * @date : 2021年06月14日 19:51:02
 **/
public abstract class AbstractHandler implements Handler{

    protected Handler handler;

    public Handler getHandler() {
        return handler;
    }

    @Override
    public void doHandler(String reqXml, Context context) {
        processHandler(reqXml,context);
        if (getHandler() != null) {
            getHandler().doHandler(reqXml,context);
        }

    }

    @Override
    public void setHandler(Handler handler) {
        this.handler = handler;

    }

    public abstract void processHandler(String reqXml, Context context);

}

